<template>
  <div class="message">
    <p>消息</p>
    <div class="message-content">
      <div class="message-header">
        <div v-for="(item, index) in list" :key="index">
          <router-link :to="item.path">
            <div class="messager-icon">
              <van-icon
                :name="item.icon"
                :style="{ background: item.background }"
              />
            </div>
            <div class="messager-title" :title="item.title">
              {{ item.title }}
            </div>
          </router-link>
        </div>
      </div>
      <div class="message-msg">
        <div v-for="(item, index) in msg" :key="index" class="msg">
          <div class="msg-img"><img :src="item.img" alt="" /></div>
          <div class="msg-title">{{ item.title }}</div>
          <div class="msg-time">{{ item.time }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  setup() {
    const list = [
      {
        title: "回答和评论",
        icon: "comment - o",
        background: "yellow",
        path: "/minequestion",
      },
      {
        title: "点赞和收藏",
        icon: "like - o",
        background: "red",
        path: "/minequestion",
      },
      {
        title: "粉丝",
        icon: "friends - o",
        background: "blue",
        path: "/minequestion",
      },
    ];
    const msg = [
      {
        title: "系统消息",
        img: require("../../../public/img/message-1.png"),
        time: "",
      },
      {
        title: "宠明小管家",
        img: require("../../../public/img/message-2.png"),
        time: "",
      },
      {
        title: "宠明编辑部",
        img: require("../../../public/img/message-3.png"),
        time: "",
      },
      {
        title: "商城客服",
        img: require("../../../public/img/message-4.png"),
        time: "",
      },
    ];
    return {
      list,
      msg,
    };
  },
};
</script>

<style lang="less" scoped>
.message {
  p {
    text-align: center;
    padding: 10px 0;
    background: #fff;
    box-shadow: 0px 1px 10px #888888;
    z-index: 10;
  }
}
.message-content {
  margin-top: 15px;
}
.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #fff;
}
.messager-icon {
  color: #fff;
  text-align: center;
  padding: 15px;
  font-size: 20px;
  .van-icon {
    padding: 10px;
    border-radius: 5px;
  }
}
.messager-title {
  font-size: 15px;
  text-align: center;
  padding: 5px 10px;
}
.message-msg {
  .msg {
    padding: 12px 25px;
    margin-top: 2px;
    background: #fff;
    font-weight: 500;
    display: flex;
    justify-content: start;
    .msg-img {
      width: 45px;
      height: 45px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .msg-title {
      font-size: 15px;
      margin-left: 18px;
    }
  }
}
</style>
